@import '@bifrostui/styles/mixins/index.less';

@{root-selector} {
  --bui-item-selector-item-width: 111px;
  --bui-item-selector-item-height: 36px;
  --bui-item-selector-item-border-radius: 20px;
  --bui-item-selector-item-margin: 4.5px 0 4.5px 9px;
  --bui-item-selector-title-height: 45px;
  --bui-item-selector-title-line-height: 45px;
  --bui-item-selector-btn-close-size: 45px;
  --bui-item-selector-btn-close-font-size: 20px;
  --bui-item-selector-container-with-title-height: calc(
    100% - var(--bui-item-selector-title-height)
  );
  --bui-item-selector-item-container-min-height: 500px;
  --bui-item-selector-select-item-buttons-padding: 7.5px 0 0 3px;
  --bui-item-selector-select-item-title-line-height: 15px;
  --bui-item-selector-list-item-height: 45px;
  --bui-item-selector-item-index-has-title-top: calc(
    50% + var(--bui-item-selector-title-height) / 2
  );
  --bui-item-selector-index-item-height: 20px;
}

.bui-item-selector {
  font-family: var(--bui-font-family);
  height: 100%;
  position: relative;

  &-title {
    width: 100%;
    height: var(--bui-item-selector-title-height);
    color: var(--bui-color-fg-default);
    font-size: var(--bui-title-size-3);
    line-height: var(--bui-item-selector-title-line-height);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1004;
    border-bottom: solid 1px var(--bui-color-border-default);
    background-color: var(--bui-color-bg-view);
  }

  &-btn-close {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--bui-item-selector-btn-close-size);
    height: var(--bui-item-selector-btn-close-size);
    color: var(--bui-color-fg-muted);
    text-align: center;
    font-size: var(--bui-item-selector-btn-close-font-size);
  }

  &-scroll-view-container {
    height: 100%;

    &.container-has-title {
      height: var(--bui-item-selector-container-with-title-height);
    }
  }

  &-all-item {
    min-height: var(--bui-item-selector-item-container-min-height);
    font-size: var(--bui-text-size-2);
    width: 100%;
    background: var(--bui-color-bg-view);
    align-self: flex-start;

    .select-item-buttons {
      display: flex;
      flex-flow: wrap;
      padding: var(--bui-item-selector-select-item-buttons-padding);
    }

    .select-item-title {
      font-size: var(--bui-title-size-4);
      line-height: var(--bui-item-selector-select-item-title-line-height);
      font-weight: var(--bui-font-weight-bold);
      padding-left: var(--bui-spacing-lg);
      padding-top: var(--bui-spacing-md);
    }
  }

  &-list {
    padding-left: var(--bui-spacing-lg);
    list-style-type: none;
  }

  &-list-item {
    height: var(--bui-item-selector-list-item-height);
    font-size: var(--bui-title-size-4);
    display: flex;
    align-items: center;

    &:not(:last-child) {
      border-bottom: 0.5px solid var(--bui-color-border-default);
    }
  }

  &-index-container {
    z-index: 1001;
    position: absolute;
    white-space: nowrap;
    right: 0;
    top: 50%;
    width: 40px;
    will-change: transform;
    // transform: translate(100%, -50%);
    transform: translate(0, -50%);
    transition:
      opacity 0.2s ease-out,
      transform 0.2s ease-out;

    &.left-in {
      opacity: 1;
      transform: translate(0, -50%);
    }

    &.item-index-has-title {
      top: var(--bui-item-selector-item-index-has-title-top);
    }

    ul {
      margin: 0;
      padding: 0;
      float: left;
      width: 100%;
      touch-action: none;
    }

    li {
      list-style: none;
      height: var(--bui-item-selector-index-item-height);
      text-align: center;
      font-size: var(--bui-text-size-3);
      color: var(--bui-color-info, --bui-color-info);
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
}
